﻿using System.Collections.ObjectModel;
using Oxage.Common;

namespace Oxage.CNC.Models
{
	public partial class ConfigViewModel : ViewModelBase
	{
		#region Constructor
		public ConfigViewModel()
		{
			this.Motors = new ObservableCollection<MotorViewModel>();
			this.Motors.Add(new MotorViewModel() { Name = "X", DegreesPerStep = 7.5, DriverType = StepperDriverType.Phase });
			this.Motors.Add(new MotorViewModel() { Name = "Y", DegreesPerStep = 7.5, DriverType = StepperDriverType.Phase });
			this.Motors.Add(new MotorViewModel() { Name = "Z", DegreesPerStep = 7.5, DriverType = StepperDriverType.Phase });

			this.Axes = new ObservableCollection<AxisViewModel>();
			this.Axes.Add(new AxisViewModel() { Name = "X", MinLimit = 0, MaxLimit = 100, Home = 0 });
			this.Axes.Add(new AxisViewModel() { Name = "Y", MinLimit = 0, MaxLimit = 100, Home = 0 });
			this.Axes.Add(new AxisViewModel() { Name = "Z", MinLimit = 0, MaxLimit = 100, Home = 0 });
		}
		#endregion

		#region Public properties
		public ObservableCollection<MotorViewModel> Motors
		{
			get
			{
				return this.motors;
			}
			set
			{
				if (this.motors != value)
				{
					this.motors = value;
					OnPropertyChanged("Motors");
				}
			}
		}
		private ObservableCollection<MotorViewModel> motors;

		public ObservableCollection<AxisViewModel> Axes
		{
			get
			{
				return this.axes;
			}
			set
			{
				if (this.axes != value)
				{
					this.axes = value;
					OnPropertyChanged("Axes");
				}
			}
		}
		private ObservableCollection<AxisViewModel> axes;
		#endregion
	}
}
